<template>
<div class="google">
    <el-card style="width: 200px">
            <div style="padding: 14px;">
                    <span>{{googleStatus}}</span>
                    <div class="bottom clearfix" v-if="!isBind">
                        <el-button type="text" @click="toBind()" class="button">{{$t('google_tobind')}}</el-button>
                    </div>
            </div>
     </el-card>

</div>
</template>

<script>
    export default {
        name: "google",
        data(){
            return {
                googleStatus:this.$t('google_bind'),
                isBind:false
            };
        },
        mounted(){
            this.checkGoogleBind();
        },
        methods:{
            checkGoogleBind(){
                this.axios
                    .get(this.GOOGLE)
                    .then(res => {
                        if (res.data.status == "success") {
                            this.googleStatus =this.$t('google_bind');
                            this.isBind=true;
                        } else {
                            this.googleStatus =this.$t('google_unbind');
                            this.isBind=false;
                        }
                    })
                    .catch(res => {

                    });
            },
            toBind(){
                this.$router.push({name:'googlebind'});
            }
        }
    }
</script>

<style scoped>

</style>
